package com.frank.subject.infra.basic.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.frank.common.entity.PageInfo;
import com.frank.subject.infra.basic.entity.SubjectInfo;
import com.frank.subject.infra.basic.mapper.SubjectInfoMapper;
import com.frank.subject.infra.basic.service.SubjectInfoService;
import org.springframework.stereotype.Service;

/**
 * 题目信息表(SubjectInfo)表服务实现类
 *
 * @author makejava
 * @since 2024-01-23 17:20:39
 */
@Service("subjectInfoService")
public class SubjectInfoServiceImpl extends ServiceImpl<SubjectInfoMapper, SubjectInfo> implements SubjectInfoService {

    private final SubjectInfoMapper subjectInfoMapper;

    public SubjectInfoServiceImpl(SubjectInfoMapper subjectInfoMapper) {
        this.subjectInfoMapper = subjectInfoMapper;
    }

    @Override
    public Page<SubjectInfo> queryPage(SubjectInfo subjectInfo, PageInfo pageInfo, Long labelId, Long categoryId) {
        Page<SubjectInfo> page = new Page<>(pageInfo.getCurrent(), pageInfo.getPageSize());
        return this.subjectInfoMapper.queryPage(page, subjectInfo, labelId, categoryId);
    }

    @Override
    public Long querySubjectIdByCursor(Long subjectId, Long categoryId, Long labelId, int cursor) {
        return subjectInfoMapper.querySubjectIdByCursor(subjectId, categoryId, labelId, cursor);
    }
}
